{layout name="p/base"}
  <div id="page-wrapper">
    <div class="row">
      <div class="col-lg-12">
        <h1>房车管理 <small>房车信息</small></h1>
        <ol class="breadcrumb">
          <li><a href="index.php"><i class="fa fa-dashboard"></i> 管理首页</a></li>
          <li class="active"><i class="fa fa-table"></i> 房车信息列表</li>
        </ol>
        <div class="alert alert-success alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          这里可以添加、修改、删除房车信息 
        </div>
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      <div class="col-lg-12">
        <a class="btn btn-primary" href="/caravan/create">添加房车</a>
        <form class="form-horizontal" role="form" action="/caravan" method="get">
          <div class="form-group col-sm-2" style="margin-right:10px;">
            <label for="">审核状态</label>
            <select class="form-control" name="status">
              <option selected value="">全部</option>
              {if(input('get.status') === '0')}
              <option selected value="0">待审核</option>
              {else/}
              <option value="0">待审核</option>
              {/if}
              {if(input('get.status') == 1)}
              <option selected value="1">审核通过</option>
              {else/}
              <option value="1">审核通过</option>
              {/if}
              {if(input('get.status') == -99)}
              <option selected value="-99">未通过审核</option>
              {else/}
              <option value="-99">未通过审核</option>
              {/if}
            </select>
          </div>
          <div class="form-group col-sm-2" style="margin-right:10px;">
            <label for="">请选择搜索条件</label>
            <select class="form-control" name="searchfield">
              <!-- <option selected value="">全部</option> -->
              {if(input('get.searchfield') == 'number')}
              <option selected value="number">房车编号</option>
              {else/}
              <option value="number">房车编号</option>
              {/if}
              {if(input('get.searchfield') == 'name')}
              <option selected value="name">房车名称</option>
              {else/}
              <option value="name">房车名称</option>
              {/if}
            </select>
          </div>
          <div class="form-group col-sm-2 input-group">  
            <label for="">请输入关键字</label>
            <input class="form-control" type="text" value="{:input('get.keyword')}" placeholder="请输入房车信息搜索" name="keyword">
            <label for="">&nbsp;</label>
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">搜索</button>
            </span>
          </div>
          <div class="clearfix"></div>
        </form>

        <div class="table-responsive">
          <table class="table table-bordered table-hover table-striped tablesorter">
            <thead>
              <tr>
                <!-- <th><div class="checker"><span><input type="checkbox" name=""></span></div></th> -->
                <th>房车编号</th>
                <th>房车名称</th>
                <th>会员账号</th>
                <th>营地名称</th>
                <th>泊位编号</th>
                <th>房车品牌</th>
                <th>参考价格</th>
                <th>旅行币基数</th>
                <th>审核状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
            
            <form id='delete' class="form-horizontal" role="form" action="/caravan/delete" method="post">
            <input type="hidden" id='method' name="_method" value="DELETE">
            <input type="hidden" name="status" value="-1" />
            {volist name='list' id='vo'}
              <tr>
                <!-- <td><div class="checker"><span><input type="checkbox" name="ids[]" value="{$vo.id}"></span></div></td> -->
                <td>{$vo.number}</td>
                <td>{$vo.name}</td>
                <td><a href="/user/read/?id={$vo.user_id}">{$vo.users.mobile}</a></td>
                <td>{$vo.camps.name}</td>
                <td>{$vo.park_num}</td>
                <td>{$vo.car_brands_id}</td>
                <td>{$vo.integral}</td>
                <td>{$vo.camps.travel_money_base}</td>
                <td>{$vo.users.status}</td>
                <td><a href="/caravan/{$vo.id}/edit">编辑</a> | <a href="/caravan/{$vo.id}" data-toggle="modal">查看详情</a> | <a href="/caravan/price/id/{$vo.id}">参考价格</a> | <a href="/card/addcard?id={$vo.id}">生成卡号</a></td>
              </tr>
            {/volist}  
            </form>
            
            </tbody>
          </table>
        </div>
        
      </div>
      <div class="col-sm-12">
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      
    </div>
  </div><!-- /#page-wrapper -->

<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript">
  $(document).ready(function(){
    $("#del").click(function(){
      $("#delete").submit();
      });
    $("#todraft").click(function(){
      $("#delete").attr('action','/caravan/setStauts');
      $("#delete").submit();
      });
    });
</script>
